//
//  ViewController.m
//  UI_homework_03_封装UIButton
//
//  Created by li cheng on 16/7/18.
//  Copyright © 2016年 li cheng. All rights reserved.
//

#import "ViewController.h"
#import "NCOfForgotPassword.h"
#import "VCOfForgotPassword.h"
#import "VCOfLogin.h"
#import "LabelOfButton.h"
#import "ImageViewOfButton.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    // 背景图片
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    imageView.image = [UIImage imageNamed:@"welcome_2"];
    [self.view addSubview:imageView];
    
    // 登录头像
    UIImageView *imageViewOfLogo = [[UIImageView alloc] initWithFrame:CGRectMake(207 - 60, 80, 120, 180)];
    imageViewOfLogo.image = [UIImage imageNamed:@"logo_lagou"];
    [self.view addSubview:imageViewOfLogo];
    
    // 登陆输入账号和密码
    UIImageView *imageViewOfHead = [[UIImageView alloc] initWithFrame:CGRectMake(207 - 180, 300, 40, 40)];
    imageViewOfHead.backgroundColor = [UIColor blackColor];
    imageViewOfHead.alpha = 0.8;
    imageViewOfHead.image = [UIImage imageNamed:@"icon_username"];
    [self.view addSubview:imageViewOfHead];
    
    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(207 - 180 + 40, 300, 320, 40)];
    textField.backgroundColor = [UIColor blackColor];
    textField.alpha = 0.2;
    [self.view addSubview:textField];
    
    UIImageView *imageViewOfPassword = [[UIImageView alloc] initWithFrame:CGRectMake(207 - 180, 342, 40, 40)];
    imageViewOfPassword.backgroundColor = [UIColor blackColor];
    imageViewOfPassword.alpha = 0.8;
    imageViewOfPassword.image = [UIImage imageNamed:@"icon_password"];
    [self.view addSubview:imageViewOfPassword];
    
    UITextField *textFieldPassword = [[UITextField alloc] initWithFrame:CGRectMake(207 - 180 + 40, 342, 320, 40)];
    textFieldPassword.backgroundColor = [UIColor blackColor];
    textFieldPassword.alpha = 0.2;
    [self.view addSubview:textFieldPassword];
    
    // 登录按钮
    UIButton *buttonOfEnter = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfEnter.backgroundColor = [UIColor colorWithRed:0.00 green:0.67 blue:0.53 alpha:1.00];
    [buttonOfEnter setTitle:@"登录" forState:UIControlStateNormal];
    buttonOfEnter.titleLabel.font = [UIFont systemFontOfSize:20];
    [buttonOfEnter setTitleColor:[UIColor colorWithRed:0.18 green:0.75 blue:0.65 alpha:1.00] forState:UIControlStateNormal];
    buttonOfEnter.frame = CGRectMake(207 - 180, 450, 360, 40);
    [buttonOfEnter.layer setCornerRadius:10];
    [self.view addSubview:buttonOfEnter];
    
    
    // 忘记密码按钮
    LabelOfButton *buttonOfPassword  = [[LabelOfButton alloc] initWithFrame: CGRectMake(207 - 180, 500, 100, 60) text:@"忘记密码?"  target:self action:@selector(ForgotPasswordButton:)  backColor:nil textColor:[UIColor whiteColor]];

    [self.view addSubview:buttonOfPassword];
    
    
    
    // 现在注册
    UIButton *buttonOfLogin = [[UIButton alloc] initWithFrame:CGRectMake(207 - 140, 550, 280, 60)];
    [buttonOfLogin setTitleColor:[UIColor colorWithRed:0.00 green:0.67 blue:0.53 alpha:1.00] forState:UIControlStateNormal];
    [buttonOfLogin setTitle:@"现在注册拉钩" forState:UIControlStateNormal];
    [buttonOfLogin addTarget:self action:@selector(LoginButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonOfLogin];
    
    // 横线or
    UIView *viewOfLine1 = [[UIView alloc] initWithFrame:CGRectMake(207 - 180, 610, 160, 1)];
    viewOfLine1.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:viewOfLine1];
    
    UILabel *labelOfOr = [[UILabel alloc] initWithFrame:CGRectMake(207 - 11, 590, 22, 40)];
    labelOfOr.text = @"or";
    labelOfOr.textColor = [UIColor whiteColor];
    [self.view addSubview:labelOfOr];
    
    UIView *viewOfLine2 = [[UIView alloc] initWithFrame:CGRectMake(207 + 22, 610, 160, 1)];
    viewOfLine2.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:viewOfLine2];
    
    // 再去逛逛button
    UIButton *buttonOfStroll = [[UIButton alloc] initWithFrame:CGRectMake(207 - 140, 620, 280, 60)];
    [buttonOfStroll setTitle:@"再去逛逛" forState:UIControlStateNormal];
    [self.view addSubview:buttonOfStroll];
    
    
    
    
    
}

// 现在注册点击事件
-(void)LoginButton:(UIButton *)loginButton{
    VCOfLogin *vcOfLogin = [[VCOfLogin alloc] init];
    [self presentViewController:vcOfLogin animated:YES completion:^{
        
    }];
}

// 忘记密码点击事件
- (void)ForgotPasswordButton:(UIButton *)forgotPasswordButton{
    
    VCOfForgotPassword *vcOfForgotPassword = [[VCOfForgotPassword alloc] init];
    NCOfForgotPassword *ncOfForgotPassword = [[NCOfForgotPassword alloc] initWithRootViewController:vcOfForgotPassword];
    [self presentViewController:ncOfForgotPassword animated:YES completion:^{
        
    }];
    //    [self.navigationController pushViewController:vcOfForgotPassword animated:YES];
    
    NSLog(@"大多数");
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
